package com.effect.exception;

import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class ResultSetBO {


    private int code;
    private String message;
    private Object result;


    public ResultSetBO(int code, String msg_zh, Object result) {
        this.code = code;
        this.message = msg_zh;
        this.result = result;
    }

    public ResultSetBO(int code, String msg_zh) {
        this.code = code;
        this.message = msg_zh;
    }

    /**
     * 通用
     *
     * @param msgCodeEnum ResultCode
     */
    public static ResultSetBO universal(ResultCode msgCodeEnum, Object result) {
        return new ResultSetBO(msgCodeEnum.getCode(), msgCodeEnum.getValue(), result);
    }

    /**
     * success 的返回结果
     * 自定义 base
     *
     * @param result base
     */
    public static ResultSetBO success(Object result) {
        return new ResultSetBO(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getValue(), result);
    }

    public static ResultSetBO success() {
        return new ResultSetBO(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getValue());
    }


    /**
     * fail 的返回结果
     * 自定义result
     *
     * @param result base
     */
    public static ResultSetBO fail(Object result) {
        return new ResultSetBO(ResultCode.FAILED.getCode(), ResultCode.FAILED.getValue(), result);
    }


    //	@Data
//	public static class MessageBean {
//		private String msg_zh;
//		private String debug_msg;
//
//		MessageBean(String msg_zh, String debug_msg) {
//			this.msg_zh = msg_zh;
//			this.debug_msg = debug_msg;
//		}
//	}
}
